<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const fn = (a) => {
        console.log(a);
      };
      fn(6);
      const fn1 = (a, b) => a + b;
      console.log(fn1(1, 3));
      //   箭头函数内部指向 取决于当前作用域
      var name = "www";
      let o = {
        name: "zx",
        sayHi: function () {
          console.log(this.name);
          setTimeout(() => {
            console.log(this.name); // 跟随sayHi的this sayHi的this取决于他的调用者 o 所以是o
          }, 1000);
        },
      };
      o.sayHi();
    </script>
  </body>
</html>
